<xsl:stylesheet version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx"
                xmlns:edm="http://schemas.microsoft.com/ado/2009/11/edm"
xmlns:ssdl="http://schemas.microsoft.com/ado/2009/11/edm/ssdl"
                exclude-result-prefixes="edmx ssdl edm"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes"/>
  <xsl:param name="EntitiesDatabase"></xsl:param>
  <xsl:template match="/edmx:Edmx/edmx:Runtime">
    using System;
    using System.Collections.Generic;
    using Rally_MvvmC.Library;
    using System.Data.Entity;
    using Newtonsoft.Json;
    using System.Data.Entity.Infrastructure;
    // Auto Generated File Edmx2Controller.xslt

    namespace _24_Hour_Blogger.Models.<xsl:value-of select="$EntitiesDatabase"/>.Api
    {
    <xsl:for-each select="edmx:ConceptualModels/edm:Schema/edm:EntityType" >
    <xsl:variable name="EntityTypeName" select="@Name" />
      <xsl:variable name="EntitySet" select="/edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/edm:Schema/edm:EntityContainer/edm:EntitySet[substring-after(@EntityType, '.') = $EntityTypeName]" />
      <xsl:variable name="EntitySetName" select="$EntitySet/@Name" />
    public class <xsl:value-of select="$EntityTypeName"/>Controller : ApiControllerBase<xsl:text disable-output-escaping="yes">&lt;</xsl:text>DataStore, <xsl:value-of select="$EntityTypeName"/>ViewModel, <xsl:value-of select="$EntityTypeName"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text>
      {
      private Func<xsl:text disable-output-escaping="yes">&lt;</xsl:text>DataStore>
        createDataStore
        {
        get
        {
        return () => new DataStore();
        }
        }

        public <xsl:value-of select="$EntityTypeName"/>Controller()
       {
          DataStore DataStore = new DataStore();
          this.DataCollection = new DataCollectionBase<xsl:text disable-output-escaping="yes">&lt;DataStore, </xsl:text><xsl:value-of select="$EntityTypeName"/>ViewModel, <xsl:value-of select="$EntityTypeName"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text>(DataStore._24_Hour_Blogger<xsl:value-of select="$EntitiesDatabase"/>Entities, DataStore._24_Hour_Blogger<xsl:value-of select="$EntitiesDatabase"/>Entities.<xsl:value-of select="$EntitySetName"/>, DataStore._24_Hour_Blogger<xsl:value-of select="$EntitiesDatabase"/>Entities.<xsl:value-of select="$EntitySetName"/>);
      }
      public <xsl:value-of select="$EntityTypeName"/>Controller(DataStore dataStore)
      {
      DataStore DataStore = dataStore;
      this.DataCollection = new DataCollectionBase<xsl:text disable-output-escaping="yes">&lt;</xsl:text>DataStore, <xsl:value-of select="$EntityTypeName"/>ViewModel, <xsl:value-of select="$EntityTypeName"/><xsl:text disable-output-escaping="yes">&gt;</xsl:text>(DataStore._24_Hour_Blogger<xsl:value-of select="$EntitiesDatabase"/>Entities, DataStore._24_Hour_Blogger<xsl:value-of select="$EntitiesDatabase"/>Entities.<xsl:value-of select="$EntitySetName"/>, DataStore._24_Hour_Blogger<xsl:value-of select="$EntitiesDatabase"/>Entities.<xsl:value-of select="$EntitySetName"/>);
      }
      }
    </xsl:for-each>
    }
  </xsl:template>

</xsl:stylesheet>
